<template>
  <t-dialog v-if="isDialog" :header="`${header}-审批、评审记录`" :visible.sync="visible" :onClose="closeDialog"
    :closeOnOverlayClick="false" :confirmBtn="null" width="80%" top="5%" id="dialog">
    <div style="height: 65vh">
      <t-tabs v-model="tabValue" @change="handleChange" id="tabs">
        <t-tab-panel value="1" class="tab-panel" label="审批记录" :destroyOnHide="true">
          <t-table rowKey="id" :data="data" :columns="columns" hover :loading="dataLoading">
            <template #approveType="{ row }">
              {{ row.approveType | filterByDict(dict.type.approve_type) }}
            </template>
            <template #approveStatus="{ row }">
              <t-tag v-if="row.approveStatus" :theme="handleTheme(row.approveStatus, dict.type.approve_status)"
                variant="light">
                {{ row.approveStatus | filterByDict(dict.type.approve_status) }}
              </t-tag>
              <t-tag v-else theme="warning" variant="light">待审批 </t-tag>
            </template>
          </t-table>
        </t-tab-panel>
        <t-tab-panel value="2" class="tab-panel" label="立项评审记录" :destroyOnHide="true">
          <!--        <div v-if="reviewGroupRecord?.content" class="query-form-inline">-->
          <!--          <h3>{{site_tag==='jtt'?'科教处':'科信部'}}意见：{{reviewGroupRecord?.content}}</h3>-->
          <!--        </div>-->
          <!-- <t-alert
            style="margin-bottom: 10px"
            theme="info"
            v-if="reviewGroupRecord?.content"
            :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`"
            :message="reviewGroupRecord?.content"
          >
          </t-alert>
          <t-alert
            v-else
            theme="info"
            style="margin-bottom: 10px"
            :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`"
            message="未提交"
          >
          </t-alert> -->
          <t-table rowKey="id" :data="data2" :columns="project.version === '2024' ? columnsOnNewProject : columns2"
            hover>
            <template #sysAttMainEntities="{ row }">
              <a class="t-button-link" v-for="(item, index) in row.sysAttMainEntities" :key="index" target="_blank"
                :href="item.fullFilePath">
                {{ item.fileName }}
              </a>
            </template>
            <template #reviewStatus="{ row }">
              <t-tag theme="success" variant="light" v-if="row.reviewStatus === '1'"> 已提交 </t-tag>
              <t-tag v-else-if="row.reviewStatus === '0'" theme="warning" variant="light">暂存</t-tag>
              <t-tag theme="danger" variant="light" v-else> 未提交 </t-tag>
            </template>
            <template #id="{ rowIndex }">
              {{ rowIndex + 1 }}
            </template>
            <template #[`experts.sysUser.duty`]="{ row }">
              <div v-if="['99999', ''].includes(row.experts?.sysUser?.profTit)">
                {{ row.experts?.sysUser?.duty }}
              </div>
              <div v-else>
                {{ row.experts?.sysUser?.duty }}/{{ row.experts?.sysUser?.profTit | filterByDict(dict.type.prof_tit) }}
              </div>
            </template>
            <template #op="{ row }">
              <t-button v-if="row.projectApproval === '1'" variant="text" class="t-button-link" @click="
                dialog.reviewType = row.reviewType;
              dialog.teamId = row.teamId;
              dialog.objId = row.id;
              dialog.open = true;
              ">
                <t-icon name="info-circle" slot="icon" />
                详情
              </t-button>
            </template>
            <template #projectApproval="{ row }">
              <!-- 否 -->
              <t-tag theme="danger" variant="light" v-if="row.projectApproval === '0'">
                <!-- {{ row.projectApproval | filterByDict(dict.type.recommend_type) }} -->
                否
              </t-tag>
              <!-- 是 -->
              <t-tag theme="success" variant="light" v-else-if="row.projectApproval === '1'">
                是
              </t-tag>
              <!-- 需要复议 -->
              <t-tag theme="warning" variant="light" v-else-if="row.projectApproval === '2'">
                需要复议
              </t-tag>
              <t-tag theme="warning" v-else variant="light"> 未提交 </t-tag>
            </template>

            <template #recommendType="{ row }">
              <t-tag theme="danger" variant="light" v-if="row.recommendType === '1'">
                {{ row.recommendType | filterByDict(dict.type.recommend_type) }}
              </t-tag>
              <t-tag theme="success" variant="light" v-else-if="row.recommendType === '2'">
                {{ row.recommendType | filterByDict(dict.type.recommend_type) }}
              </t-tag>
              <t-tag theme="success" variant="light" v-else-if="row.recommendType === '3'">
                {{ row.recommendType | filterByDict(dict.type.recommend_type) }}
              </t-tag>
              <t-tag theme="warning" v-else variant="light"> 未提交 </t-tag>
            </template>
            <template #[`experts.sysUser.education`]="{ row }">
              {{ row.sysUser?.education | filterByDict(dict.type.education) }}
            </template>
            <template #[`experts.sysUser.degree`]="{ row }">
              {{ row.sysUser?.degree | filterByDict(dict.type.degree) }}
            </template>
          </t-table>
        </t-tab-panel>
        <t-tab-panel v-if="project.version !== '2024'" value="3" class="tab-panel" label="大纲评审记录" :destroyOnHide="true">
          <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord.teamLeaderOpinion" title="专家组评审意见表">
            <template #message>
              <p class="temLeaderOpinion" v-html="reviewGroupRecord.teamLeaderOpinion"></p>
            </template>
            <template #operation>
              <t-popup placement="bottom" attach="#tabs" :overlayInnerStyle="{ width: '90%' }" destroyOnClose
                trigger="click">
                <span>查看全部</span>
                <template #content>
                  <t-card :duration="0" title="专家评审组意见表">
                    <template #content>
                      <p v-html="reviewGroupRecord.teamLeaderOpinion"></p>
                    </template>
                  </t-card>
                </template>
              </t-popup>
            </template>
          </t-alert>
          <t-alert v-else theme="info" style="margin-bottom: 10px" title="专家组评审意见表" message="未提交"> </t-alert>
          <t-table rowKey="id" :data="data2" :columns="columns3" hover id="table">
            <template #sysAttMainEntities="{ row }">
              <a class="t-button-link" v-for="(item, index) in row.sysAttMainEntities" :key="index" target="_blank"
                :href="item.fullFilePath">
                {{ item.fileName }}
              </a>
            </template>
            <template #id="{ rowIndex }">
              {{ rowIndex + 1 }}
            </template>
            <template #reviewStatus="{ row }">
              <t-tag theme="success" variant="light" v-if="row.reviewStatus === '1'"> 已提交 </t-tag>
              <t-tag v-else-if="row.reviewStatus === '0'" theme="warning" variant="light">暂存</t-tag>
              <t-tag theme="danger" variant="light" v-else> 未提交 </t-tag>
            </template>
            <template #[`experts.sysUser.duty`]="{ row }">
              <div v-if="['99999', ''].includes(row.experts?.sysUser?.profTit)">
                {{ row.experts?.sysUser?.duty }}
              </div>
              <div v-else>
                {{ row.experts?.sysUser?.duty }}/{{ row.experts?.sysUser?.profTit | filterByDict(dict.type.prof_tit) }}
              </div>
            </template>
            <template #op="{ row }">
              <t-button v-if="row.projectApproval === '1'" variant="text" class="t-button-link" @click="
                dialog.reviewType = row.reviewType;
              dialog.teamId = row.teamId;
              dialog.objId = row.id;
              dialog.open = true;
              ">
                <t-icon name="info-circle" slot="icon" />
                详情
              </t-button>
            </template>
            <template #projectApproval="{ row }">
              <!--            <t-tag theme="success" variant="light" v-if="row.projectApproval==='1'">-->
              <!--              是-->
              <!--            </t-tag>-->
              <!--            <t-tag theme="danger" variant="light" v-else-if="row.projectApproval==='0'">-->
              <!--              否-->
              <!--            </t-tag>-->
              <!--            <t-tag theme="warning" variant="light" v-else-if="row.projectApproval==='2'">-->
              <!--              需要复议-->
              <!--            </t-tag>-->
              <!--            <t-tag theme="warning" variant="light" v-else>-->
              <!--              未提交-->
              <!--            </t-tag>-->
              <t-tag v-if="row.projectApproval"
                :theme="handleTheme(row.projectApproval, dict.type.kjxm_ys_review_status)" variant="light">
                {{ row.projectApproval | filterByDict(dict.type.kjxm_ys_review_status) }}
              </t-tag>
              <t-tag v-else theme="warning" variant="light">未提交 </t-tag>
            </template>
            <template #[`experts.sysUser.education`]="{ row }">
              {{ row.sysUser?.education | filterByDict(dict.type.education) }}
            </template>
            <template #[`experts.sysUser.degree`]="{ row }">
              {{ row.sysUser?.degree | filterByDict(dict.type.degree) }}
            </template>
          </t-table>
        </t-tab-panel>
        <t-tab-panel value="4" class="tab-panel" label="验收评审记录" :destroyOnHide="true">
          <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord.teamLeaderOpinion" title="专家组评审意见表">
            <template #message>
              <p class="temLeaderOpinion" v-html="reviewGroupRecord.teamLeaderOpinion"></p>
            </template>
            <template #operation>
              <t-popup placement="bottom" attach="#tabs" :overlayInnerStyle="{ width: '90%' }" destroyOnClose
                trigger="click">
                <span>查看全部</span>
                <template #content>
                  <t-card :duration="0" title="专家评审组意见表">
                    <template #content>
                      <p v-html="reviewGroupRecord.teamLeaderOpinion"></p>
                    </template>
                  </t-card>
                </template>
              </t-popup>
            </template>
          </t-alert>
          <t-alert v-else theme="info" style="margin-bottom: 10px" title="专家组评审意见表" message="未提交"> </t-alert>
          <t-table rowKey="id" :data="data2" :columns="columns3" hover>
            <template #sysAttMainEntities="{ row }">
              <a class="t-button-link" v-for="(item, index) in row.sysAttMainEntities" :key="index" target="_blank"
                :href="item.fullFilePath">
                {{ item.fileName }}
              </a>
            </template>
            <template #id="{ rowIndex }">
              {{ rowIndex + 1 }}
            </template>
            <template #reviewStatus="{ row }">
              <t-tag theme="success" variant="light" v-if="row.reviewStatus === '1'"> 已提交 </t-tag>
              <t-tag v-else-if="row.reviewStatus === '0'" theme="warning" variant="light">暂存</t-tag>
              <t-tag theme="danger" variant="light" v-else> 未提交 </t-tag>
            </template>
            <template #[`experts.sysUser.duty`]="{ row }">
              <div v-if="['99999', ''].includes(row.experts?.sysUser?.profTit)">
                {{ row.experts?.sysUser?.duty }}
              </div>
              <div v-else>
                {{ row.experts?.sysUser?.duty }}/{{ row.experts?.sysUser?.profTit | filterByDict(dict.type.prof_tit) }}
              </div>
            </template>
            <template #op="{ row }">
              <t-button v-if="row.projectApproval === '1'" variant="text" class="t-button-link" @click="
                dialog.reviewType = row.reviewType;
              dialog.teamId = row.teamId;
              dialog.objId = row.id;
              dialog.open = true;
              ">
                <t-icon name="info-circle" slot="icon" />
                详情
              </t-button>
            </template>
            <template #projectApproval="{ row }">
              <!--            <t-tag theme="success" variant="light" v-if="row.projectApproval==='1'">-->
              <!--              是-->
              <!--            </t-tag>-->
              <!--            <t-tag theme="danger" variant="light" v-else-if="row.projectApproval==='0'">-->
              <!--              否-->
              <!--            </t-tag>-->
              <!--            <t-tag theme="warning" variant="light" v-else-if="row.projectApproval==='2'">-->
              <!--              需要复议-->
              <!--            </t-tag>-->
              <!--            <t-tag theme="warning" variant="light" v-else>-->
              <!--              未提交-->
              <!--            </t-tag>-->
              <t-tag v-if="row.projectApproval"
                :theme="handleTheme(row.projectApproval, dict.type.kjxm_ys_review_status)" variant="light">
                {{ row.projectApproval | filterByDict(dict.type.kjxm_ys_review_status) }}
              </t-tag>
              <t-tag v-else theme="warning" variant="light">未提交 </t-tag>
            </template>
            <template #[`experts.sysUser.education`]="{ row }">
              {{ row.experts?.sysUser?.education | filterByDict(dict.type.education) }}
            </template>
            <template #[`experts.sysUser.degree`]="{ row }">
              {{ row.experts?.sysUser?.degree | filterByDict(dict.type.degree) }}
            </template>
          </t-table>
        </t-tab-panel>
      </t-tabs>
    </div>
    <edit-expert-review :reviewType="dialog.reviewType" :editOpen="false" :objId="dialog.objId" :teamId="dialog.teamId"
      :visible.sync="dialog.open" v-if="dialog.open"></edit-expert-review>
  </t-dialog>
  <div v-else>
    <t-tabs v-model="tabValue" @change="handleChange">
      <t-tab-panel value="1" class="tab-panel" label="审批记录" :destroyOnHide="true">
        <t-table rowKey="id" :data="data" :columns="columns" hover :loading="dataLoading">
          <template #approveType="{ row }">
            {{ row.approveType | filterByDict(dict.type.approve_type) }}
          </template>
          <template #approveStatus="{ row }">
            <t-tag v-if="row.approveStatus" :theme="handleTheme(row.approveStatus, dict.type.approve_status)"
              variant="light">
              {{ row.approveStatus | filterByDict(dict.type.approve_status) }}
            </t-tag>
            <t-tag v-else theme="warning" variant="light">待审批 </t-tag>
          </template>
        </t-table>
      </t-tab-panel>
      <t-tab-panel value="2" class="tab-panel" label="立项评审记录" :destroyOnHide="true">
        <!--        <div v-if="reviewGroupRecord?.content" class="query-form-inline">-->
        <!--          <h3>{{site_tag==='jtt'?'科教处':'科信部'}}意见：{{reviewGroupRecord?.content}}</h3>-->
        <!--        </div>-->
        <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord?.content"
          :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`" :message="reviewGroupRecord?.content">
        </t-alert>
        <t-alert v-else theme="info" style="margin-bottom: 10px" :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`"
          message="未提交">
        </t-alert>
        <t-table rowKey="id" :data="data2" :columns="columns2" hover>
          <template #sysAttMainEntities="{ row }">
            <a class="t-button-link" v-for="(item, index) in row.sysAttMainEntities" :key="index" target="_blank"
              :href="item.fullFilePath">
              {{ item.fileName }}
            </a>
          </template>
          <template #reviewStatus="{ row }">
            <t-tag theme="success" variant="light" v-if="row.reviewStatus === '1'"> 已提交 </t-tag>
            <t-tag v-else-if="row.reviewStatus === '0'" theme="warning" variant="light">暂存</t-tag>
            <t-tag theme="danger" variant="light" v-else> 未提交 </t-tag>
          </template>
          <template #id="{ rowIndex }">
            {{ rowIndex + 1 }}
          </template>
          <template #[`experts.sysUser.duty`]="{ row }">
            <div v-if="['99999', ''].includes(row.experts?.sysUser?.profTit)">
              {{ row.experts?.sysUser?.duty }}
            </div>
            <div v-else>
              {{ row.experts?.sysUser?.duty }}/{{ row.experts?.sysUser?.profTit | filterByDict(dict.type.prof_tit) }}
            </div>
          </template>
          <template #op="{ row }">
            <t-button v-if="row.projectApproval === '1'" variant="text" class="t-button-link" @click="
              dialog.reviewType = row.reviewType;
            dialog.teamId = row.teamId;
            dialog.objId = row.id;
            dialog.open = true;
            ">
              <t-icon name="info-circle" slot="icon" />
              详情
            </t-button>
          </template>
          <template #recommendType="{ row }">
            <t-tag theme="danger" variant="light" v-if="row.recommendType === '1'">
              {{ row.recommendType | filterByDict(dict.type.recommend_type) }}
            </t-tag>
            <t-tag theme="success" variant="light" v-else-if="row.recommendType === '2'">
              {{ row.recommendType | filterByDict(dict.type.recommend_type) }}
            </t-tag>
            <t-tag theme="success" variant="light" v-else-if="row.recommendType === '3'">
              {{ row.recommendType | filterByDict(dict.type.recommend_type) }}
            </t-tag>
            <t-tag theme="warning" v-else variant="light"> 未提交 </t-tag>
          </template>
          <!--          <template #projectApproval="{row}">-->
          <!--            <t-tag theme="success" v-if="row.projectApproval==='1'">-->
          <!--              是-->
          <!--            </t-tag>-->
          <!--            <t-tag theme="danger" v-else>-->
          <!--              否-->
          <!--            </t-tag>-->
          <!--          </template>-->
          <template #[`experts.sysUser.education`]="{ row }">
            {{ row.sysUser?.education | filterByDict(dict.type.education) }}
          </template>
          <template #[`experts.sysUser.degree`]="{ row }">
            {{ row.sysUser?.degree | filterByDict(dict.type.degree) }}
          </template>
        </t-table>
      </t-tab-panel>
      <t-tab-panel value="3" v-if="row.project.version !== '2024'" class="tab-panel" label="大纲评审记录"
        :destroyOnHide="true">
        <!--        <div v-if="reviewGroupRecord?.content" class="query-form-inline">-->
        <!--          <h3>{{site_tag==='jtt'?'科教处':'科信部'}}意见：{{reviewGroupRecord?.content}}</h3>-->
        <!--        </div>-->
        <!--        <div  class="query-form-inline">-->
        <!--          <h3>专家组评审意见表：<a v-if="psYjsFilesNow.length>0" class="t-button-link" target="_blank"  :href="psYjsFilesNow[0].url" >-->
        <!--            {{psYjsFilesNow[0].name}}-->
        <!--          </a><span v-else>未提交</span></h3>-->
        <!--        </div>-->
        <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord?.content"
          :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`" :message="reviewGroupRecord?.content">
        </t-alert>
        <t-alert v-else theme="info" style="margin-bottom: 10px" :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`"
          message="未提交">
        </t-alert>
        <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord.teamLeaderOpinion" title="专家组评审意见表">
          <template #message>
            <p class="temLeaderOpinion" v-html="reviewGroupRecord.teamLeaderOpinion"></p>
          </template>
          <template #operation>
            <t-popup placement="bottom" attach="#tabs" :overlayInnerStyle="{ width: '90%' }" destroyOnClose
              trigger="click">
              <span>查看全部</span>
              <template #content>
                <t-card :duration="0" title="专家评审组意见表">
                  <template #content>
                    <p v-html="reviewGroupRecord.teamLeaderOpinion"></p>
                  </template>
                </t-card>
              </template>
            </t-popup>
          </template>
        </t-alert>
        <t-alert v-else theme="info" style="margin-bottom: 10px" title="专家组评审意见表" message="未提交"> </t-alert>
        <t-table rowKey="id" :data="data2" :columns="columns3" hover>
          <template #sysAttMainEntities="{ row }">
            <a class="t-button-link" v-for="(item, index) in row.sysAttMainEntities" :key="index" target="_blank"
              :href="item.fullFilePath">
              {{ item.fileName }}
            </a>
          </template>
          <template #id="{ rowIndex }">
            {{ rowIndex + 1 }}
          </template>
          <template #reviewStatus="{ row }">
            <t-tag theme="success" variant="light" v-if="row.reviewStatus === '1'"> 已提交 </t-tag>
            <t-tag v-else-if="row.reviewStatus === '0'" theme="warning" variant="light">暂存</t-tag>
            <t-tag theme="danger" variant="light" v-else> 未提交 </t-tag>
          </template>
          <template #[`experts.sysUser.duty`]="{ row }">
            <div v-if="['99999', ''].includes(row.experts?.sysUser?.profTit)">
              {{ row.experts?.sysUser?.duty }}
            </div>
            <div v-else>
              {{ row.experts?.sysUser?.duty }}/{{ row.experts?.sysUser?.profTit | filterByDict(dict.type.prof_tit) }}
            </div>
          </template>
          <template #op="{ row }">
            <t-button v-if="row.projectApproval === '1'" variant="text" class="t-button-link" @click="
              dialog.reviewType = row.reviewType;
            dialog.teamId = row.teamId;
            dialog.objId = row.id;
            dialog.open = true;
            ">
              <t-icon name="info-circle" slot="icon" />
              详情
            </t-button>
          </template>
          <template #projectApproval="{ row }">
            <!--            <t-tag theme="success" variant="light" v-if="row.projectApproval==='1'">-->
            <!--              是-->
            <!--            </t-tag>-->
            <!--            <t-tag theme="danger" variant="light" v-else-if="row.projectApproval==='0'">-->
            <!--              否-->
            <!--            </t-tag>-->
            <!--            <t-tag theme="warning" variant="light" v-else-if="row.projectApproval==='2'">-->
            <!--              需要复议-->
            <!--            </t-tag>-->
            <!--            <t-tag theme="warning" variant="light" v-else>-->
            <!--              未提交-->
            <!--            </t-tag>-->
            <t-tag v-if="row.projectApproval" :theme="handleTheme(row.projectApproval, dict.type.kjxm_ys_review_status)"
              variant="light">
              {{ row.projectApproval | filterByDict(dict.type.kjxm_ys_review_status) }}
            </t-tag>
            <t-tag v-else theme="warning" variant="light">未提交 </t-tag>
          </template>
          <template #[`experts.sysUser.education`]="{ row }">
            {{ row.sysUser?.education | filterByDict(dict.type.education) }}
          </template>
          <template #[`experts.sysUser.degree`]="{ row }">
            {{ row.sysUser?.degree | filterByDict(dict.type.degree) }}
          </template>
        </t-table>
      </t-tab-panel>
      <t-tab-panel value="4" class="tab-panel" label="验收评审记录" :destroyOnHide="true">
        <!--        <div v-if="reviewGroupRecord?.content" class="query-form-inline">-->
        <!--          <h3>{{site_tag==='jtt'?'科教处':'科信部'}}意见：{{reviewGroupRecord?.content}}</h3>-->
        <!--        </div>-->
        <!--        <div  class="query-form-inline">-->
        <!--          <h3>专家组评审意见表：<a v-if="psYjsFilesNow.length>0" class="t-button-link" target="_blank"  :href="psYjsFilesNow[0].url" >-->
        <!--            {{psYjsFilesNow[0].name}}-->
        <!--          </a><span v-else>未提交</span></h3>-->
        <!--        </div>-->
        <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord?.content"
          :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`" :message="reviewGroupRecord?.content">
        </t-alert>
        <t-alert v-else theme="info" style="margin-bottom: 10px" :title="`${site_tag === 'jtt' ? '科教处' : '科信部'}意见`"
          message="未提交">
        </t-alert>
        <t-alert style="margin-bottom: 10px" theme="info" v-if="reviewGroupRecord.teamLeaderOpinion" title="专家组评审意见表">
          <template #message>
            <p class="temLeaderOpinion" v-html="reviewGroupRecord.teamLeaderOpinion"></p>
          </template>
          <template #operation>
            <t-popup placement="bottom" attach="#tabs" :overlayInnerStyle="{ width: '90%' }" destroyOnClose
              trigger="click">
              <span>查看全部</span>
              <template #content>
                <t-card :duration="0" title="专家评审组意见表">
                  <template #content>
                    <p v-html="reviewGroupRecord.teamLeaderOpinion"></p>
                  </template>
                </t-card>
              </template>
            </t-popup>
          </template>
        </t-alert>
        <t-alert v-else theme="info" style="margin-bottom: 10px" title="专家组评审意见表" message="未提交"> </t-alert>
        <t-table rowKey="id" :data="data2" :columns="columns3" hover>
          <template #sysAttMainEntities="{ row }">
            <a class="t-button-link" v-for="(item, index) in row.sysAttMainEntities" :key="index" target="_blank"
              :href="item.fullFilePath">
              {{ item.fileName }}
            </a>
          </template>
          <template #id="{ rowIndex }">
            {{ rowIndex + 1 }}
          </template>
          <template #reviewStatus="{ row }">
            <t-tag theme="success" variant="light" v-if="row.reviewStatus === '1'"> 已提交 </t-tag>
            <t-tag v-else-if="row.reviewStatus === '0'" theme="warning" variant="light">暂存</t-tag>
            <t-tag theme="danger" variant="light" v-else> 未提交 </t-tag>
          </template>
          <template #[`experts.sysUser.duty`]="{ row }">
            <div v-if="['99999', ''].includes(row.experts?.sysUser?.profTit)">
              {{ row.experts?.sysUser?.duty }}
            </div>
            <div v-else>
              {{ row.experts?.sysUser?.duty }}/{{ row.experts?.sysUser?.profTit | filterByDict(dict.type.prof_tit) }}
            </div>
          </template>
          <template #op="{ row }">
            <t-button v-if="row.projectApproval === '1'" variant="text" class="t-button-link" @click="
              dialog.reviewType = row.reviewType;
            dialog.teamId = row.teamId;
            dialog.objId = row.id;
            dialog.open = true;
            ">
              <t-icon name="info-circle" slot="icon" />
              详情
            </t-button>
          </template>
          <template #projectApproval="{ row }">
            <!--            <t-tag theme="success" variant="light" v-if="row.projectApproval==='1'">-->
            <!--              是-->
            <!--            </t-tag>-->
            <!--            <t-tag theme="danger" variant="light" v-else-if="row.projectApproval==='0'">-->
            <!--              否-->
            <!--            </t-tag>-->
            <!--            <t-tag theme="danger" variant="light" v-else-if="row.projectApproval==='2'">-->
            <!--              需要复议-->
            <!--            </t-tag>-->
            <!--            <t-tag theme="warning" variant="light" v-else>-->
            <!--              未提交-->
            <!--            </t-tag>-->
            <t-tag v-if="row.projectApproval" :theme="handleTheme(row.projectApproval, dict.type.kjxm_ys_review_status)"
              variant="light">
              {{ row.projectApproval | filterByDict(dict.type.kjxm_ys_review_status) }}
            </t-tag>
            <t-tag v-else theme="warning" variant="light">未提交 </t-tag>
          </template>
          <template #[`experts.sysUser.education`]="{ row }">
            {{ row.experts?.sysUser?.education | filterByDict(dict.type.education) }}
          </template>
          <template #[`experts.sysUser.degree`]="{ row }">
            {{ row.experts?.sysUser?.degree | filterByDict(dict.type.degree) }}
          </template>
        </t-table>
      </t-tab-panel>
    </t-tabs>
  </div>
</template>

<script>
import EditExpertReview from '../../review/components/edit-expert-review.vue';
import { getFiles } from '@/api/common';

export default {
  name: 'approve-list',
  dicts: [
    'approve_type',
    'subject_classification',
    'prof_tit',
    'duty',
    'recommend_type',
    'approve_status',
    'kjxm_ys_review_status',
  ],
  components: {
    EditExpertReview,
  },
  props: {
    objId: [String, Number],
    row: Object,
    // header: String,
    isDialog: {
      type: Boolean,
      default: true,
    },
    header: {
      type: String,
      default: '',
    },
    projectName: {
      type: String,
    },
    tabDefaultValue: {
      type: String,
      default: '1',
    },
  },
  data () {
    return {
      site_tag: import.meta.env.VITE_SITE_TAG,
      tabValue: this.tabDefaultValue,
      dialog: {
        objId: 0,
        teamId: 0,
        open: false,
        reviewType: null,
      },
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        approveType: '',
        businessName: '',
      },
      visible: true,
      data: [],
      columns: [
        // {
        //   colKey: "businessId",
        //   title: "业务id",
        //   align: "center"
        // },
        {
          colKey: 'businessName',
          title: '业务名称',
          align: 'center',
          ellipsis: true,
        },
        {
          colKey: 'approveType',
          title: '审批业务类型',
          align: 'center',
        },
        {
          colKey: 'approverName',
          title: '审批人',
          align: 'center',
        },
        {
          colKey: 'deptName',
          title: '单位',
          align: 'center',
        },
        {
          colKey: 'opinion',
          title: '审批意见',
          align: 'center',
          width: 300,
          // ellipsis: true
        },
        {
          colKey: 'approveStatus',
          title: '审批结果',
          align: 'center',
        },
        {
          colKey: 'updateTime',
          title: '审批时间',
          align: 'center',
          width: 200,
        },
      ],

      dataLoading: false,
      data2: [],
      columns2: [
        { colKey: 'id', title: '专家序号', align: 'center', width: 100 },
        { colKey: 'reviewStatus', title: '评审状态', align: 'center', width: 100 },
        { colKey: 'score', title: '评审分数', align: 'center', width: 100 },
        { colKey: 'content', title: '评审意见', align: 'center', width: 300 },
        { colKey: 'sysAttMainEntities', title: '评审附件', align: 'center', width: 120 },
        { colKey: 'recommendType', title: '是否推荐', align: 'center', width: 100 },
        // {
        //   colKey: "experts.sysUser.dept.deptName",
        //   title: "所在单位",
        //   align: "center"
        // },
        // {colKey: 'experts.sysUser.duty', title: '职务/职称',align: "center"},
        // // {colKey: 'experts.profTit', title: '职称',align: "center"},
        // {colKey: 'experts.sysUser.majorName', title: '专业',align: "center"},
        // {colKey: 'experts.sysUser.majorNowName', title: '现从事专业',align: "center"},
        // {
        //   colKey: "experts.sysUser.education",
        //   title: "学历",
        //   align: "center",
        //   ellipsis: true
        // },
        // {
        //   colKey: "experts.sysUser.degree",
        //   title: "学位",
        //   align: "center",
        //   ellipsis: true
        // },

        // {colKey: 'projectApproval', title: '是否通过',align: "center"},
        // {
        //   colKey: "op",
        //   title: "操作",
        //   align: "center"
        // },
      ],
      columns3: [
        {
          colKey: 'id',
          title: '专家序号',
          align: 'center',
          width: 100,
        },
        // {
        //   colKey: "experts.sysUser.nickName",
        //   title: "专家姓名",
        //   align: "center"
        // },
        // {
        //   colKey: "experts.sysUser.dept.deptName",
        //   title: "所在单位",
        //   align: "center"
        // },
        // {colKey: 'experts.sysUser.duty', title: '职务/职称',align: "center"},
        // // {colKey: 'experts.profTit', title: '职称',align: "center"},
        // {colKey: 'experts.sysUser.majorName', title: '专业',align: "center"},
        // {colKey: 'experts.sysUser.majorNowName', title: '现从事专业',align: "center"},
        // {
        //   colKey: "experts.sysUser.education",
        //   title: "学历",
        //   align: "center",
        //   ellipsis: true
        // },
        // {
        //   colKey: "experts.sysUser.degree",
        //   title: "学位",
        //   align: "center",
        //   ellipsis: true
        // },
        { colKey: 'reviewStatus', title: '评审状态', align: 'center', width: 100 },
        { colKey: 'content', title: '评审意见', align: 'center', width: 300 },
        { colKey: 'sysAttMainEntities', title: '评审附件', align: 'center', width: 120 },
        // {colKey: 'score', title: '评审分数',align: "center"},
        // {colKey: 'projectApproval', title: '是否通过',align: "center"},
        { colKey: 'projectApproval', title: '是否通过', align: 'center', width: 100 },
        {
          colKey: 'updateTime',
          title: '审批时间',
          align: 'center',
          width: 200,
        },
        // {
        //   colKey: "op",
        //   title: "操作",
        //   align: "center"
        // },
      ],
      columnsOnNewProject: [
        { colKey: 'id', title: '专家序号', align: 'center', width: 100 },
        { colKey: 'reviewStatus', title: '评审状态', align: 'center', width: 100 },
        // { colKey: 'score', title: '评审分数', align: 'center', width: 100 },
        { colKey: 'content', title: '评审意见', align: 'center', width: 300 },
        { colKey: 'sysAttMainEntities', title: '评审附件', align: 'center', width: 120 },
        // { colKey: 'recommendType', title: '是否推荐', align: 'center', width: 100 },
        { colKey: 'projectApproval', title: '是否通过', align: 'center', width: 100 },
        {
          colKey: 'updateTime',
          title: '审批时间',
          align: 'center',
          width: 200,
        },
      ],
      reviewGroupRecord: {},
      psYjsFilesNow: [],
      project: []
    };
  },
  created () {
    this.getList();
    // this.getLxReviewList();
    // this.getDgReviewList();
    // this.getYsReviewList();
    this.getKjcReply();
    this.getReviewList();

    this.$api.kjxm.project.get(this.objId).then((response) => {
      this.project = response.data
    }).catch((e) => {
      this.$message.error(e.toString());
    });
  },
  methods: {
    handleChange (val) {
      this.reviewGroupRecord = {};
      this.getKjcReply();
      this.getReviewList();
    },
    getKjcReply () {
      if (Number(this.tabValue) > 1) {
        this.$api.kjxm.review
          .projectReviewTeamGetByBusinessIdAndReviewType({
            businessId: this.objId,
            reviewType: (Number(this.tabValue) - 1).toString(),
          })
          .then((res) => {
            this.reviewGroupRecord = res.data;
          })
          .catch((e) => {
            this.$message.error(e.toString());
          });
      }
    },
    getList () {
      this.dataLoading = true;
      this.$api.kjxm.approve
        .getByBusinessId(this.objId)
        .then((response) => {
          this.data = response.data;
          this.dataLoading = false;
          // this.formData.id = this.row.id;
          // this.formData.businessId = this.row.businessId;
          // this.formData.approveType = this.row.approveType;
        })
        .catch((e) => {
          this.dataLoading = false;
          this.$message.error(e.toString());
        });
    },

    getReviewList () {
      this.data2 = [];
      // const tempParam = {projectId: this.objId, reviewType: ''}
      if (Number(this.tabValue) > 1) {
        // this.$api.kjxm.review.projectExpertsInfoByReviewType(tempParam)
        this.$api.kjxm.review.projectExpertsInfoByReviewType({ projectId: this.objId, reviewType: (Number(this.tabValue) - 1).toString(), })
          .then((response) => {
            this.data2 = response.data || [];
            this.psYjsFilesNow = [];
            // if (Number(this.tabValue) > 2 && this.data2.length > 0) {
            //   this.$api.kjxm.review.getByTeamIdAndBusinessId(this.objId, this.data2[0].teamId)
            //     .then((res) => {
            //       console.log(res.data)
            //       getFiles(res.data.id)
            //         .then((res) => {
            //           const files = {};
            //           res.data.forEach((item) => {
            //             if (!files[item.moduleKey]) {
            //               files[item.moduleKey] = [];
            //             }
            //             files[item.moduleKey].push({
            //               name: item.fileName,
            //               url: item.fullFilePath,
            //               id: item.id,
            //               filePath: item.filePath,
            //             });
            //           });
            //           this.psYjsFilesNow = files.dgAndYsPsYjs || [];
            //         })
            //         .catch((e) => {
            //           this.$message.error(e.toString());
            //         });
            //     })
            //     .catch((e) => {
            //       this.$message.error(e.toString());
            //     });
            // }
          })
          .catch((e) => {
            this.$message.error(e.toString());
          });
      }
    },
    closeDialog () {
      this.$emit('update:visible', false);
    },
  },
};
</script>

<style lang="less" scoped>
.t-tab-panel {
  padding: 10px;
}

.tab-panel {
  height: calc(65vh - 64px);
  overflow: scroll;
}

.temLeaderOpinion {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  /* 可以显示的行数，超出部分用...表示*/
  -webkit-box-orient: vertical;
}
</style>
